﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using System.ComponentModel;

namespace FingerPrint.WebUI.Models
{
    // Define the schema and table to connect
    [Table("SalesOrder", Schema = "Sales")]
    public class SalesOrder
    {
        //[HiddenInput(DisplayValue = false)]
        public int SalesOrderID { get; set; }

        [DisplayName("SalesOrder Number")]
        [Required(ErrorMessage = "Please enter a SalesOrderNumber")]
        public string SalesOrderNumber { get; set; }

        [DisplayName("Received Date")]
        [DataType(DataType.Date)]
        public DateTime? ReceivedDate { get; set; }

        [DisplayName("Received By")]
        public int? EmployeeID { get; set; }    // the int? means it is a nullable type

        [DisplayName("Customer ID")]
        public int? CustomerID { get; set; }

        [DisplayName("Contact ID")]
        public int? ContactID { get; set; }

        [DisplayName("Deadline")]
        [DataType(DataType.Date)]
        public DateTime? Deadline { get; set; }

        [DisplayName("Invoice Number")]
        public string InvoiceNumber { get; set; }

        //[Required(ErrorMessage = "Plesae provide remark")]
        [DataType(DataType.MultilineText)]
        [DisplayName("Remark")]
        public string Remark { get; set; }

        [DisplayName("Modified Date")]
        public DateTime? ModifiedDate { get; set; }

        [DisplayName("Status")]
        public string Status { get; set; }


        // Generic Product Inforamtion
        [DisplayName("File Name")]
        public string Filename { get; set; }

        [DisplayName("New Job")]
        public bool IsNewJob { get; set; }

        [DisplayName("EM")]
        public bool IsEM { get; set; }

        [DisplayName("FTP")]
        public bool IsFTP { get; set; }

        [DisplayName("CD/DVD")]
        public bool IsDVD { get; set; }

        [DisplayName("Mac")]
        public bool IsMac { get; set; }

        [DisplayName("PC")]
        public bool IsPC { get; set; }

        [DisplayName("Test")]
        public bool IsTest { get; set; }

        [DataType(DataType.MultilineText)]
        [DisplayName("Notes")]
        public string Notes { get; set; }

        [DisplayName("Quantity")]
        public string Quantity { get; set; }

        [DisplayName("Size")]
        public string Size { get; set; }

        [DisplayName("Unit")]
        public string Unit { get; set; }




        // One-One relationship
        public virtual Employee Employee { get; set; }
        public virtual Customer Customer { get; set; }

        // One-Many relationship
        public virtual ICollection<Product> Products { get; set; }

    }
}
